﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using JM.JCY.BusinessEntity;
using JM.JCY.Proxy;
using NCS.IConnect.ApplicationContexts;
using JM.JCY.Common;
using JM.JCY.Common.Utilities;
using Microsoft.SharePoint;

namespace JM.JCY.SharePointComponent.IncorruptArchives.CreateLingDaoSalary
{
    public partial class CreateLingDaoSalaryUserControl : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

            }
        }

        protected void imgSubmit_Click(object sender, ImageClickEventArgs e)
        {
            using (IncorruptProxy proxy = new IncorruptProxy())
            {
                var newDT = new IncorruptDataSet.T_LingDaoSalaryDataTable();
                var newRow = newDT.NewT_LingDaoSalaryRow();

                newRow.Name = this.txtName.Text;
                newRow.Gender = this.rbGender.SelectedValue;
                newRow.PoliticSituation = this.txtPoliticSituation.Text;
                newRow.Position = this.txtPosition.Text;
                newRow.Year = this.txtYear.Text;
                newRow.Salary = this.txtSalary.Text;
                newRow.Benefits = this.txtBenefits.Text;
                newRow.WorkCharge = this.txtWorkCharge.Text;
                newRow.Others = this.txtOthers.Text;
                newRow.Total = this.txtTotal.Text;
                newRow.Instruction = this.txtInstruction.Text;
                newRow.Remark = this.txtRemark.Text;
                newRow.FillDate = this.dtFillDate.SelectedDate;

                JCYUtility.UpdateCommonFields(newRow, "Iori");
                newDT.AddT_LingDaoSalaryRow(newRow);
                proxy.UpdateLingDaoSalary(newDT);

                Response.Redirect("LingDaoSalary.aspx");

            }
        }

        protected void imgCancel_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("LingDaoSalary.aspx");

        }
    }
}
